package rssmanager.service;


import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;



public class FluxRSSDAO implements Iterable {
	private ArrayList<FluxRSS> flux=null;
	private static FluxRSSDAO instance=null;

	public FluxRSSDAO() {
		flux=new ArrayList<FluxRSS>();
	}
	public static FluxRSSDAO getInstance()
	{
		if(instance==null)
			instance=new FluxRSSDAO();
		return instance;
	}
	
	public void addFlux(FluxRSS f)
	{
		flux.add(f);
	}
	
	public FluxRSS getFlux(int id)
	{
		for(FluxRSS f  : flux)
		{
			if(f.getId()==id)
				return f;
		}
		return null;
	}
	
	public FluxRSS getFluxAt(int i)
	{
		return flux.get(i);
	}
	
	public void delFlux(int id)
	{
		
		for(int i=0;i<flux.size();i++)
		{
			if(flux.get(i).getId()==id)
				flux.remove(i);
		}
	}
	
	public ArrayList<FluxRSS> getFluxList()
	{
		return flux;
	}
	
	@Override
	public Iterator iterator() {
		// TODO Auto-generated method stub
		return null;
	}
	
}
